//
//  MZY_ProjectCell.m
//  FullHouse
//
//  Created by dllo on 16/1/21.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_ProjectCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation MZY_ProjectCell

- (void)dealloc
{
    [self.backView release];
    [self.pictureImageView release];
    [self.authorImageView release];
    [self.titleLabel release];
    [self.introduceLabel release];
    [self.likeButton release];
    [self.likeCountLabel release];
    [self.priceLabel release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    
    self.backgroundView = [[UIView alloc]init];
    self.backgroundView.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.backgroundView];
    [self.backgroundView release];
    
    self.backView = [[UIView alloc]init];
    self.backView.backgroundColor = [UIColor whiteColor];
    [self.backgroundView addSubview:self.backView];
    [self.backView release];
    
    self.pictureImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.pictureImageView];
    [self.pictureImageView release];
    
    self.authorImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.authorImageView];
    [self.authorImageView release];
    
    self.titleLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.titleLabel];
    [self.titleLabel release];
    
    self.introduceLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.introduceLabel];
    [self.introduceLabel release];
    
    self.likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.backView addSubview:self.likeButton];
    
    self.likeCountLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.likeCountLabel];
    [self.likeCountLabel release];
    
    self.priceLabel = [[UILabel alloc]init];
    self.priceLabel.backgroundColor = [UIColor orangeColor];
    [self.pictureImageView addSubview:self.priceLabel];
    [self.priceLabel release];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.backView.frame = CGRectMake(0, 0, WIDTH, 330);
    self.pictureImageView.frame = CGRectMake(0, 0, WIDTH, HEIGHT - 90);
    self.authorImageView.frame = CGRectMake(10, HEIGHT - 80, 50, 50);
    self.titleLabel.frame = CGRectMake(70, HEIGHT - 80, WIDTH - 120, 20);
    self.introduceLabel.frame = CGRectMake(70, HEIGHT - 50, WIDTH - 120, 20);
    self.likeButton.frame = CGRectMake(WIDTH - 40, HEIGHT - 80, 25, 25);
    self.likeCountLabel.frame = CGRectMake(WIDTH - 40, HEIGHT - 50, 30, 20);
    self.priceLabel.frame = CGRectMake(WIDTH - 70, 10, 70, 30);
}


@end
